Accessing structure through pointers [c]
Posted
by Blackbinary
on Stack Overflow
See other posts from Stack Overflow
or by Blackbinary
Published on 2010-04-01T00:24:45Z
Indexed on
2010/04/01
0:33 UTC
Read the original article
Hit count: 335
I've got a structure which holds names and ages. I've made a linked-list of these structures, using this as a pointer:
aNode *rootA;
in my main. Now i send **rootA to a function like so
addElement(5,"Drew",**rootA);
Because i need to pass rootA by reference so that I can edit it in other functions (in my actual program i have two roots, so return will not work)
The problem is, in my program, i can't say access the structure members.
*rootA->age = 4;
for example doesnt work.
Hopefully you guys can help me out. Thanks!
© Stack Overflow or respective owner